package com.zmzncs.lmtc.module.schedule;

import com.alibaba.fastjson.JSONObject;
import com.zmzncs.lmtc.common.config.ClientConfig;
import com.zmzncs.lmtc.common.util.DateTimeUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * 定时任务类 asd
 */
@Slf4j
@Component
public class Schedule {

    @Autowired
    private ClientConfig clientConfig;
    //  初始化标志
    private boolean initFlag = true;

    /**
     * MQ订阅状态检测
     * 每10秒触发
     */
//    @Scheduled(cron = "0/10 * * * * ? ")
//    public void cloudInternetTime() throws InterruptedException {
//        //  项目刚启动完时，先睡眠5秒，要不然发送消息时可能，mqtt还没连接
//        if(initFlag) Thread.sleep(5000);
//
//        JSONObject publishJson = new JSONObject();
//        publishJson.put("time", DateTimeUtil.getTime());
//
//        clientConfig.publish("cloud/internet/time", "cloud/internet/time", publishJson.toString());
//    }

}
